<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item> <i class="el-icon-shopping-bag-2"></i> 用户管理 </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="handle-box">
        <el-button type="primary" class="handle-del mr10" @click="addClick">新增</el-button>
        <el-date-picker class="mr10" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"
                        v-model="query.time">
        </el-date-picker>
        <el-input placeholder="请输入产品名称查询" v-model="query.souVal" class="handle-input mr10"></el-input>
        <el-button type="primary" icon="el-icon-search">搜索</el-button>
      </div>
      <el-table v-loading="loading" :data="tableData" border class="table" style="width: 100%" ref="multipleTable"
                header-cell-class-name="table-header" @selection-change="SelectionChange">
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column type="index" :index="tableIndex" label="序号" width="55" align="center"></el-table-column>
        <el-table-column prop="name" label="姓名" width="210"></el-table-column>
        <el-table-column prop="phone" label="电话" width="150"></el-table-column>
        <el-table-column prop="gender" label="性别" width="100"></el-table-column>
        <el-table-column prop="dateOfBirth" label="出生日期" width="210"></el-table-column>
        <el-table-column prop="eduText" label="学历" width="150"></el-table-column>
        <el-table-column prop="mobileCreate" label="创建时间" width="210"></el-table-column>
        <el-table-column fixed="right" label="操作" width="210" align="center">
          <template slot-scope="scope">
            <el-button type="text" icon="el-icon-edit" class="red" @click="editClick(scope.row.id)">编辑补充</el-button>
            <el-button type="text" icon="el-icon-remove-outline" class="red" @click="blacklist(scope.row.id)">加入黑名单</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination background layout="total, prev, pager, next" :current-page="query.page" :page-size="query.limit" :total="page.totalCount"
                       :pager-count="5" @current-change="PageChange" @prev-click="PageChange" @next-click="PageChange"></el-pagination>
      </div>

      <el-drawer title="用户信息" :visible.sync="nameDrawerFlg" size="85%" :with-header="false">
        <div class="nameDrawer">
          <el-form :rules="formDataRules" ref="formUserName" :model="formData" label-width="110px" v-loading="formUserNameLoad">
            <el-row :gutter="20" v-loading="formData.basic.loading">
              <el-divider class="heng-border">基本信息</el-divider>
              <el-col :span="6">
                <el-form-item label="姓名" prop="basic.name">
                  <el-input v-model="formData.basic.name"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="电话" prop="basic.tel">
                  <el-input v-model="formData.basic.tel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="微信号" prop="basic.weixin">
                  <el-input v-model="formData.basic.weixin"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="性别" prop="basic.sex">
                  <el-select v-model="formData.basic.sex" class="elSelect" placeholder="请选择性别">
                    <el-option v-for="(item,i) in formData.basic.sexArr" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="身份证号" prop="basic.shenId">
                  <el-input v-model="formData.basic.shenId"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="所在城市" prop="basic.city">
                  <el-cascader v-model="formData.basic.city" :options="formData.basic.cityData"></el-cascader>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="出生日期" prop="basic.birthData">
                  <el-date-picker style="width: 100%" v-model="formData.basic.birthData" type="date" format="yyyy-MM-dd" placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="家庭住址" prop="basic.familyAddress">
                  <el-input v-model="formData.basic.familyAddress"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="现居住地址" prop="basic.liveAddress">
                  <el-input v-model="formData.basic.liveAddress"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="婚姻状况" prop="basic.marriage">
                  <el-select v-model="formData.basic.marriage" placeholder="请选择">
                    <el-option v-for="(item,i) in formData.basic.marriageArr" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="配偶姓名" prop="basic.spouseName">
                  <el-input v-model="formData.basic.spouseName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="配偶电话" prop="basic.spouseTel">
                  <el-input v-model="formData.basic.spouseTel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="工作单位" prop="basic.workCompany">
                  <el-input v-model="formData.basic.workCompany"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="头像">
                  <el-upload class="upload-demo" ref="uploadtou" action="http://www.dazhimu.cc/fileUpload/file2Base64" :headers="uploadHeader"
                             :limit="1" :on-success="filetouChange" :on-progress="filetouloadChange" :show-file-list="false"
                             style="float: left; margin-right: 10px">
                    <el-button size="small" type="primary" :loading="formData.basic.touLoad">上传照片</el-button>
                  </el-upload>
                  <el-link :href="formData.basic.touImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                </el-form-item>
              </el-col>

            </el-row>
            <div style="text-align: center">
              <el-button type="primary" @click="addBasicSub" :loading="formData.basic.loading">提交</el-button>
            </div>
            <el-row :gutter="20" v-loading="formData.EDU.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">学历信息</el-divider>
              <el-col :span="6">
                <el-form-item label="是否毕业" prop="EDU.isGraduation">
                  <el-radio-group v-model="formData.EDU.isGraduation">
                    <el-radio label="1">是</el-radio>
                    <el-radio label="2">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="学历" prop="EDU.education">
                  <el-select v-model="formData.EDU.education" class="elSelect" placeholder="请选择学历">
                    <el-option v-for="(item,i) in formData.EDU.educationArr" :key="item.eduText" :label="item.eduText" :value="item.eduType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="学校名称" prop="EDU.schoolName">
                  <el-input v-model="formData.EDU.schoolName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="学校地址" prop="EDU.schoolAddress">
                  <el-input v-model="formData.EDU.schoolAddress"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="formData.EDU.isGraduation == '1'">
                <el-form-item label="毕业证编号" prop="EDU.cardNumber">
                  <el-input v-model="formData.EDU.cardNumber"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="formData.EDU.isGraduation == '2'">
                <el-form-item label="学号" prop="EDU.studentNumber">
                  <el-input v-model="formData.EDU.studentNumber"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="学信网核查">
                  <el-select v-model="formData.EDU.check" class="elSelect" placeholder="请选择核查结果" disabled>
                    <el-option label="真实" value="1"></el-option>
                    <el-option label="无效" value="2"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.EDU.loading" @click="addEDUSub">提交</el-button>
            </div>
            <el-row :gutter="20" v-loading="formData.car.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">车辆信息</el-divider>
              <el-col :span="6">
                <el-form-item label="是否有车" prop="car.isCar">
                  <el-radio-group v-model="formData.car.isCar">
                    <el-radio label="1">是</el-radio>
                    <el-radio label="2">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <template v-if="formData.car.isCar == '1'">
                <el-col :span="6">
                  <el-form-item label="绿本照片">
                    <el-upload class="upload-demo" ref="upload" action="http://www.dazhimu.cc/fileUpload/file" :headers="uploadHeader" :limit="1"
                               accept=".png" :on-success="(res,file)=>{fileChange('greenBookImg',res,file)}"
                               :on-progress="fileloadChange('greenBookImgLoad')" :show-file-list="false" style="float: left; margin-right: 10px">
                      <el-button size="small" type="primary" :loading="formData.car.greenBookImgLoad">上传照片</el-button>
                    </el-upload>
                    <el-link :href="formData.car.greenBookImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="行驶证照片">
                    <el-upload class="upload-demo" ref="upload" action="/ddw/fileUpload/file" :headers="uploadHeader" :limit="1" accept=".png"
                               :on-success="(res,file)=>{fileChange('drivingLicenseImg',res,file)}"
                               :on-progress="fileloadChange('drivingLicenseImgLoad')" :show-file-list="false" style="float: left; margin-right: 10px">
                      <el-button size="small" type="primary" :loading="formData.car.drivingLicenseImgLoad">上传照片</el-button>
                    </el-upload>
                    <el-link :href="formData.car.drivingLicenseImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="车辆品牌" prop="car.carBrand">
                    <el-input v-model="formData.car.carBrand"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="车辆类型" prop="car.carType">
                    <el-select v-model="formData.car.carType" filterable class="elSelect" placeholder="请选择车辆类型">
                      <el-option v-for="(item,i) in formData.car.carTypeArr" :key="item.vtName" :label="item.vtName" :value="item.vtId"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="车辆所属城市" prop="car.carCity">
                    <el-cascader v-model="formData.car.carCity" :options="formData.car.carCityArr"></el-cascader>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="车辆识别代号" prop="car.carId">
                    <el-input v-model="formData.car.carId"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="发动机号" prop="car.engineNumber">
                    <el-input v-model="formData.car.engineNumber"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="车辆估值金额" prop="car.carMoney">
                    <el-input v-model="formData.car.carMoney" disabled></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="是否按揭" prop="car.isMortgage">
                    <el-radio-group v-model="formData.car.isMortgage">
                      <el-radio label="1">是</el-radio>
                      <el-radio label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="6" v-if="formData.car.isMortgage == '1'">
                  <el-form-item label="月付金额" prop="car.monthMoney">
                    <el-input v-model="formData.car.monthMoney"></el-input>
                  </el-form-item>
                </el-col>
              </template>

            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.car.loading" @click="addCarSub">提交</el-button>
            </div>
            <el-row :gutter="20" v-loading="formData.room.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">房屋信息</el-divider>
              <el-col :span="6">
                <el-form-item label="是否有房" prop="room.isRoom">
                  <el-radio-group v-model="formData.room.isRoom">
                    <el-radio label="1">是</el-radio>
                    <el-radio label="2">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <template v-if="formData.room.isRoom == '1'">

                <el-col :span="6">
                  <el-form-item label="是否按揭" prop="room.isMortgage">
                    <el-radio-group v-model="formData.room.isMortgage">
                      <el-radio label="1">是</el-radio>
                      <el-radio label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="6" v-if="formData.room.isMortgage == '1'">
                  <el-form-item label="房屋合同照片">
                    <el-upload class="upload-demo" ref="upload" action="http://www.dazhimu.cc/fileUpload/file" :headers="uploadHeader" :limit="1"
                               accept=".png" :on-success="(res,file)=>{fileChange('roomContractImg',res,file)}"
                               :on-progress="fileloadChange('roomContractImgLoad')" :show-file-list="false" style="float: left; margin-right: 10px">
                      <el-button size="small" type="primary" :loading="formData.room.roomContractImgLoad">上传照片</el-button>
                    </el-upload>
                    <el-link :href="formData.room.roomContractImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="6" v-if="formData.room.isMortgage == '1'">
                  <el-form-item label="合同人姓名" prop="room.contractName">
                    <el-input v-model="formData.room.contractName"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="不动产照片">
                    <el-upload class="upload-demo" ref="upload" action="http://www.dazhimu.cc/fileUpload/file" :headers="uploadHeader" :limit="1"
                               accept=".png" :on-success="(res,file)=>{fileChange('realEstateImg',res,file)}"
                               :on-progress="fileloadChange('realEstateImgLoad')" :show-file-list="false" style="float: left; margin-right: 10px">
                      <el-button size="small" type="primary" :loading="formData.room.realEstateImgLoad">上传照片</el-button>
                    </el-upload>
                    <el-link :href="formData.room.realEstateImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="房本姓名" prop="room.roomBookName">
                    <el-input v-model="formData.room.roomBookName"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="房屋性质" prop="room.roomNature">
                    <el-select v-model="formData.room.roomNature" filterable class="elSelect" placeholder="请选择房屋性质">
                      <el-option v-for="(item,i) in formData.room.roomNatureArr" :key="item.houseText" :label="item.houseText"
                                 :value="item.houseType">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="所在城市" prop="room.roomCity">
                    <el-cascader v-model="formData.room.roomCity" :options="formData.room.roomCityArr"></el-cascader>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="房屋地址" prop="room.roomAddress">
                    <el-input v-model="formData.room.roomAddress"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="不动产单元号" prop="room.realEstateNumber">
                    <el-input v-model="formData.room.realEstateNumber"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="房屋类型" prop="room.roomType">
                    <el-input v-model="formData.room.roomType"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="用途" prop="room.purpose">
                    <el-input v-model="formData.room.purpose"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="面积" prop="room.square">
                    <el-input v-model="formData.room.square"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="房屋估值金额" prop="room.roomMoney">
                    <el-input v-model="formData.room.roomMoney" disabled></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="房龄" prop="room.roomAge">
                    <el-input v-model="formData.room.roomAge"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="权利其他状况" prop="room.roomOther">
                    <el-input v-model="formData.room.roomOther"></el-input>
                  </el-form-item>
                </el-col>
              </template>

            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.room.loading" @click="addRoomSub">提交</el-button>
            </div>

            <el-row :gutter="20" v-loading="formData.enterprise.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">企业融资信息</el-divider>
              <el-col :span="6">
                <el-form-item label="是否企业融资" prop="enterprise.isEnterprise">
                  <el-radio-group v-model="formData.enterprise.isEnterprise">
                    <el-radio label="1">是</el-radio>
                    <el-radio label="2">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <template v-if="formData.enterprise.isEnterprise == '1'">
                <el-col :span="6">
                  <el-form-item label="营业执照照片">
                    <el-upload class="upload-demo" ref="upload" action="http://www.dazhimu.cc/fileUpload/file" :headers="uploadHeader" :limit="1"
                               accept=".png" :on-success="(res,file)=>{fileChange('businessImg',res,file)}"
                               :on-progress="fileloadChange('businessImgLoad')" :show-file-list="false" style="float: left; margin-right: 10px">
                      <el-button size="small" type="primary" :loading="formData.enterprise.businessImgLoad">上传照片</el-button>
                    </el-upload>
                    <el-link :href="formData.enterprise.businessImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="公司名称" prop="enterprise.companyName">
                    <el-input v-model="formData.enterprise.companyName"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="公司地址" prop="enterprise.companyAddress">
                    <el-input v-model="formData.enterprise.companyAddress"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="公司电话" prop="enterprise.companyTel">
                    <el-input v-model="formData.enterprise.companyTel"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="企业身份" prop="enterprise.companyIdentity">
                    <el-select v-model="formData.enterprise.companyIdentity" class="elSelect" placeholder="请选择企业身份">
                      <el-option label="法人" value="1"></el-option>
                      <el-option label="股东" value="2"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="持股百分比" prop="enterprise.ShareholdingNumber">
                    <el-input v-model="formData.enterprise.ShareholdingNumber"></el-input>
                  </el-form-item>
                </el-col>
              </template>
            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.enterprise.loading" @click="addEnterpriseSub">提交</el-button>
            </div>

            <el-row :gutter="20" v-loading="formData.taxCredit.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">税贷信息</el-divider>
              <el-col :span="6">
                <el-form-item label="是否税贷" prop="taxCredit.isTaxCredit">
                  <el-radio-group v-model="formData.taxCredit.isTaxCredit">
                    <el-radio label="1">是</el-radio>
                    <el-radio label="2">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="formData.taxCredit.isTaxCredit == '1'">
                <el-form-item label="年度纳税额" prop="taxCredit.yearPayTaxesMoney">
                  <el-input v-model="formData.taxCredit.yearPayTaxesMoney"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="formData.taxCredit.isTaxCredit == '1'">
                <el-form-item label="纳税等级" prop="taxCredit.payTaxesGrade">
                  <el-select v-model="formData.taxCredit.payTaxesGrade" class="elSelect" placeholder="请选择纳税等级">
                    <el-option v-for="(item,i) in formData.taxCredit.payTaxesGradeArr" :key="item.taxText" :label="item.taxText"
                               :value="item.taxType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.taxCredit.loading" @click="addTaxCreditSub">提交</el-button>
            </div>
            <el-row :gutter="20" v-loading="formData.Other.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">其他信息</el-divider>
              <el-col :span="6">
                <el-form-item label="打卡工资金额" prop="Other.wagesNumber">
                  <el-input v-model="formData.Other.wagesNumber"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="工资发放形式" prop="Other.wagesType">
                  <el-select v-model="formData.Other.wagesType" class="elSelect" placeholder="请选择工资发放形式">
                    <el-option v-for="(item,i) in formData.Other.wagesTypeArr" :key="item.wagesText" :label="item.wagesText" :value="item.wagesType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="企业性质" prop="Other.enterpriseNature">
                  <el-select v-model="formData.Other.enterpriseNature" class="elSelect" placeholder="请选择企业性质">
                    <el-option v-for="(item,i) in formData.Other.enterpriseNatureArr" :key="item.enterpriseText" :label="item.enterpriseText"
                               :value="item.enterpriseType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位电话" prop="Other.companyTel">
                  <el-input v-model="formData.Other.companyTel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="公积金个缴" prop="Other.accumulationMoneypersonal">
                  <el-input v-model="formData.Other.accumulationMoneypersonal" placeholder="请输入公积金个缴基数"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="缴纳时长" prop="Other.AM_paymentTime">
                  <el-input v-model="formData.Other.AM_paymentTime" placeholder="请输入公积金缴纳时长"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="社保基数" prop="Other.sociologyGuaranteeMoney">
                  <el-input v-model="formData.Other.sociologyGuaranteeMoney" placeholder="请输入社保基数"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="缴纳时长" prop="Other.SGM_paymentTime">
                  <el-input v-model="formData.Other.SGM_paymentTime" placeholder="请输入社保缴纳时长"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="支付宝芝麻分" prop="Other.ZFB_number">
                  <el-input v-model="formData.Other.ZFB_number" placeholder="请输入芝麻信用分"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="微粒贷额度" prop="Other.WLD_number">
                  <el-input v-model="formData.Other.WLD_number" placeholder="请输入微粒贷额度"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保单">
                  <el-upload class="upload-demo" ref="upload" action="http://www.dazhimu.cc/fileUpload/file" :headers="uploadHeader" :limit="1"
                             accept=".pdf" :on-success="(res,file)=>{fileChange('policyImg',res,file)}" :on-progress="fileloadChange('policyImgLoad')"
                             :show-file-list="false" style="float: left; margin-right: 10px">
                    <el-button size="small" type="primary" :loading="formData.Other.policyImgLoad">上传一年以上保单</el-button>
                  </el-upload>
                  <el-link :href="formData.Other.policyImg" target="_blank" type="primary" :underline="false">查看照片</el-link>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单份最高金额" prop="Other.policyHighestMoney">
                  <el-input v-model="formData.Other.policyHighestMoney" placeholder="请输入保单单份最高金额"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保单缴费时长" prop="Other.P_paymentTime">
                  <el-input v-model="formData.Other.P_paymentTime" placeholder="请输入保单缴费时长"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.Other.loading" @click="addOtherSub">提交</el-button>
            </div>
            <el-row :gutter="20" v-loading="formData.contacts.loading" v-if="operationFlg == 'edit'">
              <el-divider class="heng-border">联系人信息</el-divider>
              <el-col :span="6">
                <el-form-item label="直系亲属姓名" prop="contacts.linealName">
                  <el-input v-model="formData.contacts.linealName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="关系" prop="contacts.l_relationship">
                  <el-select v-model="formData.contacts.l_relationship" filterable class="elSelect" placeholder="请选择关系">
                    <el-option v-for="(item,i) in formData.contacts.relationshipArr" :key="item.relationText" :label="item.relationText"
                               :value="item.relationType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="直系亲属电话" prop="contacts.l_tel">
                  <el-input v-model="formData.contacts.l_tel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="直系亲属单位" prop="contacts.l_company">
                  <el-input v-model="formData.contacts.l_company"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="其他联系人1" prop="contacts.one_linealName">
                  <el-input v-model="formData.contacts.one_linealName" placeholder="其他联系人姓名"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="关系" prop="contacts.one_relationship">
                  <el-select v-model="formData.contacts.one_relationship" filterable class="elSelect" placeholder="请选择其他联系人关系">
                    <el-option v-for="(item,i) in formData.contacts.relationshipArr" :key="item.relationText" :label="item.relationText"
                               :value="item.relationType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="电话" prop="contacts.one_tel">
                  <el-input v-model="formData.contacts.one_tel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位" prop="contacts.one_company">
                  <el-input v-model="formData.contacts.one_company"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="其他联系人2" prop="contacts.two_linealName">
                  <el-input v-model="formData.contacts.two_linealName" placeholder="其他联系人姓名"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="关系" prop="contacts.two_relationship">
                  <el-select v-model="formData.contacts.two_relationship" filterable class="elSelect" placeholder="请选择其他联系人关系">
                    <el-option v-for="(item,i) in formData.contacts.relationshipArr" :key="item.relationText" :label="item.relationText"
                               :value="item.relationType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="电话" prop="contacts.two_tel">
                  <el-input v-model="formData.contacts.two_tel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位" prop="contacts.two_company">
                  <el-input v-model="formData.contacts.two_company"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="其他联系人3" prop="contacts.three_linealName">
                  <el-input v-model="formData.contacts.three_linealName" placeholder="其他联系人姓名"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="关系" prop="contacts.three_relationship">
                  <el-select v-model="formData.contacts.three_relationship" filterable class="elSelect" placeholder="请选择其他联系人关系">
                    <el-option v-for="(item,i) in formData.contacts.relationshipArr" :key="item.relationText" :label="item.relationText"
                               :value="item.relationType">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="电话" prop="contacts.three_tel">
                  <el-input v-model="formData.contacts.three_tel"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位" prop="contacts.three_company">
                  <el-input v-model="formData.contacts.three_company"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div style="text-align: center" v-if="operationFlg == 'edit'">
              <el-button type="primary" :loading="formData.contacts.loading" @click="addContactsSub">提交</el-button>
            </div>
          </el-form>
        </div>
      </el-drawer>
    </div>
    <!-- 图片裁剪 -->
    <el-dialog title="图片裁剪" :visible.sync="cropper.cropperFlg" width="30%">
      <div class="cropper-content">
        <div class="cropper" style="text-align: center">
          <vueCropper ref="cropper" :img="cropper.option.img" :outputSize="cropper.option.size" :outputType="cropper.option.outputType" :info="true"
                      :full="cropper.option.full" :canMove="cropper.option.canMove" :canMoveBox="cropper.option.canMoveBox"
                      :original="cropper.option.original" :autoCrop="cropper.option.autoCrop" :fixed="cropper.option.fixed"
                      :fixedNumber="cropper.option.fixedNumber" :centerBox="cropper.option.centerBox" :infoTrue="cropper.option.infoTrue"
                      :fixedBox="cropper.option.fixedBox"></vueCropper>
        </div>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="cropper.cropperFlg = false">取 消</el-button>
        <el-button type="primary" @click="finish" :loading="touupdateImgLoad">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import Storage from '../../../utils/localStorage';
import CITYARRDATA from '../../../utils/city';
import { VueCropper } from 'vue-cropper';
import { userListData, userAddBasicSub, userEditQuerySub, userEditEDUSub, userEditCarSub, userEditRoomSub, userEditEnterpriseSub, userEditTaxCreditSub, userEditOtherSub, userEditContactsSub, userGetSelect, userEditBasicSub, userBlackList, businessListAddBase64 } from '../../../api/index';

export default {
  data() {
    return {
      operationFlg: 'add',
      operationId: '',
      nameDrawerFlg: false,
      loading: false,
      query: {
        page: 1,
        limit: 10,
        time: [],
        souVal: ''
      },
      tableData: [],
      page: {
        totalCount: 100
      },
      touupdateImgLoad: false,
      cropper: {
        cropperFlg: false,
        option: {
          img: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3875709917,887364088&fm=26&gp=0.jpg', // 裁剪图片的地址
          info: false, // 裁剪框的大小信息
          outputSize: 0.8, // 裁剪生成图片的质量
          outputType: 'jpeg', // 裁剪生成图片的格式
          canScale: false, // 图片是否允许滚轮缩放
          autoCrop: true, // 是否默认生成截图框
          // autoCropWidth: 300, // 默认生成截图框宽度
          // autoCropHeight: 200, // 默认生成截图框高度
          fixedBox: true, // 固定截图框大小 不允许改变
          fixed: true, // 是否开启截图框宽高固定比例
          fixedNumber: [5, 5], // 截图框的宽高比例
          full: true, // 是否输出原图比例的截图
          canMoveBox: false, // 截图框能否拖动
          original: false, // 上传图片按照原始比例渲染
          centerBox: true, // 截图框是否被限制在图片里面
          infoTrue: true // true 为展示真实输出图片宽高 false 展示看到的截图框宽高
        }
      },
      formUserNameLoad: false,
      formData: {
        //基本信息
        basic: {
          loading: false,
          name: '',
          tel: '',
          weixin: '',
          sex: '',
          sexArr: [
            { value: '1', label: '男' },
            { value: '2', label: '女' }
          ],
          shenId: '',
          city: '',
          cityData: CITYARRDATA,
          birthData: '',
          familyAddress: '',
          liveAddress: '',
          marriage: '',
          marriageArr: [
            { value: '0', label: '未婚' },
            { value: '1', label: '已婚' },
            { value: '2', label: '离异' },
            { value: '3', label: '丧偶' }
          ],
          spouseName: '',
          spouseTel: '',
          workCompany: '',
          touImg: '',
          touLoad: false,
        },
        //学历信息
        EDU: {
          loading: false,
          isGraduation: '1',
          education: '',
          educationArr: [],
          schoolName: '',
          schoolAddress: '',
          cardNumber: '',
          studentNumber: '',
          check: ''
        },
        //车辆信息
        car: {
          loading: false,
          isCar: '1',
          greenBookImg: '',
          greenBookImgLoad: false,
          drivingLicenseImg: '',
          drivingLicenseImgLoad: false,
          carBrand: '',
          carType: '',
          carTypeArr: [],
          carCity: '',
          carCityArr: CITYARRDATA,
          carId: '',
          engineNumber: '',
          carMoney: '',
          isMortgage: '1',
          monthMoney: ''
        },
        //房屋信息
        room: {
          loading: false,
          isRoom: '1',
          isMortgage: '1',
          roomContractImg: '',
          roomContractImgLoad: false,
          contractName: '',
          realEstateImg: '',
          realEstateImgLoad: false,
          roomBookName: '',
          roomNature: '',
          roomNatureArr: [],
          roomCity: '',
          roomCityArr: CITYARRDATA,
          roomAddress: '',
          realEstateNumber: '',
          roomType: '',
          purpose: '',
          square: '',
          roomMoney: '',
          roomAge: '',
          roomOther: ''
        },
        //企业融资信息
        enterprise: {
          loading: false,
          isEnterprise: '1',
          businessImg: '',
          businessImgLoad: false,
          companyName: '',
          companyAddress: '',
          companyTel: '',
          companyIdentity: '',
          ShareholdingNumber: ''
        },
        //税贷信息
        taxCredit: {
          loading: false,
          isTaxCredit: '1',
          yearPayTaxesMoney: '',
          payTaxesGrade: '',
          payTaxesGradeArr: []
        },
        //其他信息
        Other: {
          loading: false,
          wagesNumber: '',
          wagesType: '',
          wagesTypeArr: [],
          enterpriseNature: '',
          enterpriseNatureArr: [],
          companyTel: '',
          accumulationMoneypersonal: '',
          AM_paymentTime: '',
          sociologyGuaranteeMoney: '',
          SGM_paymentTime: '',
          ZFB_number: '',
          WLD_number: '',
          policyImg: '',
          policyImgLoad: false,
          policyHighestMoney: '',
          P_paymentTime: ''
        },
        //联系人信息
        contacts: {
          loading: false,
          linealName: '',
          one_linealName: '',
          two_linealName: '',
          three_linealName: '',
          l_relationship: '',
          one_relationship: '',
          two_relationship: '',
          three_relationship: '',
          relationshipArr: [],
          l_tel: '',
          one_tel: '',
          two_tel: '',
          three_tel: '',
          l_company: '',
          one_company: '',
          two_company: '',
          three_company: ''
        }
      },
      formDataRules: {
        'basic.name': [{ required: true, message: '请输入姓名', trigger: 'blur' }],
        'basic.tel': [{ required: true, message: '请输入正确的电话', pattern: /^1[3456789]\d{9}$/, trigger: 'blur' }],
        'basic.weixin': [{ required: true, message: '请输入微信号', trigger: 'blur' }],
        'basic.sex': [{ required: true, message: '请选择性别', trigger: 'change' }],
        'basic.shenId': [
          {
            required: true,
            message: '请输入正确的身份证号码',
            pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
            trigger: 'blur'
          }
        ],
        'basic.city': [{ required: true, message: '请选择所在城市', trigger: 'change' }],
        'basic.birthData': [{ required: true, message: '请选择出生日期', trigger: 'change' }],
        'basic.familyAddress': [{ required: true, message: '请输入家庭地址', trigger: 'blur' }],
        'basic.liveAddress': [{ required: true, message: '请输入现居住地址', trigger: 'blur' }],
        'basic.marriage': [{ required: true, message: '请选择婚姻状况', trigger: 'change' }],
        'basic.spouseName': [{ required: true, message: '请输入配偶姓名', trigger: 'blur' }],
        'basic.spouseTel': [{ required: true, message: '请输入配偶电话', pattern: /^1[3456789]\d{9}$/, trigger: 'blur' }],
        'basic.workCompany': [{ required: true, message: '请输入工作单位', trigger: 'blur' }],
        'EDU.isGraduation': [{ required: true, message: '请选择是否毕业', trigger: 'change' }],
        'EDU.education': [{ required: true, message: '请选择学历', trigger: 'change' }],
        'EDU.schoolName': [{ required: true, message: '请输入学校名称', trigger: 'blur' }],
        'EDU.schoolAddress': [{ required: true, message: '请输入学校地址', trigger: 'blur' }],
        'EDU.cardNumber': [{ required: true, message: '请输入真实毕业证编号', pattern: /\d/, trigger: 'blur' }],
        'EDU.studentNumber': [{ required: true, message: '请输入正确的学号格式', pattern: /\d/, trigger: 'blur' }],
        'car.isCar': [{ required: true, message: '请选择是否有车', trigger: 'change' }],
        'car.carBrand': [{ required: true, message: '请输入车辆品牌', trigger: 'blur' }],
        'car.carType': [{ required: true, message: '请选择车辆类型', trigger: 'change' }],
        'car.carCity': [{ required: true, message: '请选择车辆所在城市', trigger: 'change' }],
        'car.carId': [{ required: true, message: '请输入车辆识别代号', trigger: 'blur' }],
        'car.engineNumber': [{ required: true, message: '请输入发动机号', trigger: 'blur' }],
        'car.carMoney': [{ required: true, message: '请输入车辆估值金额', trigger: 'blur' }],
        'car.isMortgage': [{ required: true, message: '请选择是否按揭', trigger: 'change' }],
        'car.monthMoney': [{ required: true, message: '请输入月付金额', trigger: 'blur' }],
        'room.isRoom': [{ required: true, message: '请选择是否有房', trigger: 'change' }],
        'room.isMortgage': [{ required: true, message: '请选择是否按揭', trigger: 'change' }],
        'room.contractName': [{ required: true, message: '请输入合同人姓名', trigger: 'blur' }],
        'room.roomBookName': [{ required: true, message: '请输入房本姓名', trigger: 'blur' }],
        'room.roomNature': [{ required: true, message: '请选择房屋性质', trigger: 'change' }],
        'room.roomCity': [{ required: true, message: '请选择所在城市', trigger: 'change' }],
        'room.roomAddress': [{ required: true, message: '请输入房屋地址', trigger: 'blur' }],
        'room.realEstateNumber': [{ required: true, message: '请输入不动产单元号', trigger: 'blur' }],
        'room.roomType': [{ required: true, message: '请输入房屋类型', trigger: 'blur' }],
        'room.purpose': [{ required: true, message: '请输入用途', trigger: 'blur' }],
        'room.square': [{ required: true, message: '请输入面积', trigger: 'blur' }],
        'room.roomMoney': [{ required: true, message: '请输入房屋估值金额', trigger: 'blur' }],
        'room.roomAge': [{ required: true, message: '请输入房龄', trigger: 'blur' }],
        'room.roomOther': [{ required: true, message: '请输入权力其他状况', trigger: 'blur' }],
        'enterprise.isEnterprise': [{ required: true, message: '请选择是否企业融资', trigger: 'change' }],
        'enterprise.companyName': [{ required: true, message: '请输入公司名称', trigger: 'blur' }],
        'enterprise.companyAddress': [{ required: true, message: '请输入公司地址', trigger: 'blur' }],
        'enterprise.companyTel': [{ required: true, message: '请输入公司电话', trigger: 'blur' }],
        'enterprise.companyIdentity': [{ required: true, message: '请选择企业身份', trigger: 'change' }],
        'enterprise.ShareholdingNumber': [{ required: true, message: '请输入持股百分比', trigger: 'blur' }],
        'taxCredit.isTaxCredit': [{ required: true, message: '请选择是否税贷', trigger: 'change' }],
        'taxCredit.yearPayTaxesMoney': [{ required: true, message: '请输入年度纳税额', trigger: 'blur' }],
        'taxCredit.payTaxesGrade': [{ required: true, message: '请选择纳税等级', trigger: 'change' }],
        'Other.wagesNumber': [{ required: true, message: '请输入打卡工资金额', trigger: 'blur' }],
        'Other.wagesType': [{ required: true, message: '请选择工资发放形式', trigger: 'change' }],
        'Other.enterpriseNature': [{ required: true, message: '请选择企业性质', trigger: 'change' }],
        'Other.companyTel': [{ required: true, message: '请输入单位电话', trigger: 'blur' }],
        'Other.accumulationMoneypersonal': [{ required: true, message: '请输入公积金个缴', trigger: 'blur' }],
        'Other.AM_paymentTime': [{ required: true, message: '请输入缴纳时长', trigger: 'blur' }],
        'Other.sociologyGuaranteeMoney': [{ required: true, message: '请输入社保基数', trigger: 'blur' }],
        'Other.SGM_paymentTime': [{ required: true, message: '请输入缴纳时长', trigger: 'blur' }],
        'Other.ZFB_number': [{ required: true, message: '请输入支付宝芝麻分', trigger: 'blur' }],
        'Other.WLD_number': [{ required: true, message: '请输入微粒贷额度', trigger: 'blur' }],
        'Other.policyHighestMoney': [{ required: true, message: '请输入单份最高金额', trigger: 'blur' }],
        'Other.P_paymentTime': [{ required: true, message: '请输入缴费时长', trigger: 'blur' }],
        'contacts.linealName': [{ required: true, message: '请输入直系亲属姓名', trigger: 'blur' }],
        'contacts.one_linealName': [{ required: true, message: '请输入其他联系人1', trigger: 'blur' }],
        'contacts.two_linealName': [{ required: true, message: '请输入其他联系人2', trigger: 'blur' }],
        'contacts.three_linealName': [{ required: true, message: '请输入其他联系人3', trigger: 'blur' }],
        'contacts.l_relationship': [{ required: true, message: '请选择关系', trigger: 'blur' }],
        'contacts.one_relationship': [{ required: true, message: '请选择关系', trigger: 'blur' }],
        'contacts.two_relationship': [{ required: true, message: '请选择关系', trigger: 'blur' }],
        'contacts.three_relationship': [{ required: true, message: '请选择关系', trigger: 'blur' }],
        'contacts.l_tel': [{ required: true, message: '请输入直系亲属电话', pattern: /^1[3456789]\d{9}$/, trigger: 'blur' }],
        'contacts.one_tel': [{ required: true, message: '请输入电话', pattern: /^1[3456789]\d{9}$/, trigger: 'blur' }],
        'contacts.two_tel': [{ required: true, message: '请输入电话', pattern: /^1[3456789]\d{9}$/, trigger: 'blur' }],
        'contacts.three_tel': [{ required: true, message: '请输入电话', pattern: /^1[3456789]\d{9}$/, trigger: 'blur' }],
        'contacts.l_company': [{ required: true, message: '请输入直系亲属单位', trigger: 'blur' }],
        'contacts.one_company': [{ required: true, message: '请输入单位', trigger: 'blur' }],
        'contacts.two_company': [{ required: true, message: '请输入单位', trigger: 'blur' }],
        'contacts.three_company': [{ required: true, message: '请输入单位', trigger: 'blur' }],
      },

      excelLoad: false,
      uploadHeader: { Authorization: Storage.getItem('token') ? Storage.getItem('token') : '1' }
    };
  },
  components: {
    VueCropper
  },
  created() {
    this.getListData();
    this.getSelectValArr();
  },
  methods: {
    //列表信息
    getListData() {
      this.loading = true;
      let query = {
        startTime: this.query.time[0] ? this.query.time[0] : '',
        endTime: this.query.time[1] ? this.query.time[1] : '',
        kw: this.query.souVal,
        limit: this.query.limit,
        page: this.query.page
      };
      userListData(query).then((res) => {
        this.loading = false;
        if (res.code === 0) {
          if (res.list.length > 0) {
            res.list.forEach((item, i) => {
              item.gender = item.gender == 1 ? '男' : '女';
            });
          }
          this.tableData = res.list;
          this.page.totalCount = res.totalCount;
        } else {
          this.$message(res.msg);
        }
      });
    },
    //获取下拉数据
    getSelectValArr() {
      userGetSelect().then((res) => {
        if (res.code === 0) {
          console.log(res);
          this.formData.EDU.educationArr = res.edu;
          this.formData.car.carTypeArr = res.vehicleType;
          this.formData.room.roomNatureArr = res.house;
          this.formData.taxCredit.payTaxesGradeArr = res.tax;
          this.formData.Other.wagesTypeArr = res.wages;
          this.formData.Other.enterpriseNatureArr = res.enterprise;
          this.formData.contacts.relationshipArr = res.contacts;
        } else {
          this.$message(res.msg);
        }
      });
    },
    //序号
    tableIndex(index) {
      return (this.query.page - 1) * this.query.limit + index + 1;
    },
    //翻页
    PageChange(num) {
      this.query.page = num;
      this.getListData();
    },
    //选中
    SelectionChange() { },
    //新增
    addClick() {
      this.operationFlg = 'add';
      this.operationId = '';
      this.nameDrawerFlg = true;
    },
    //编辑补充信息
    editClick(id) {
      this.operationFlg = 'edit';
      this.operationId = id;
      this.nameDrawerFlg = true;
      this.editQuery(id);
    },
    //编辑 初始化查询
    editQuery(id) {
      this.formUserNameLoad = true;
      userEditQuerySub({ biId: id }).then((res) => {
        this.formUserNameLoad = false;
        if (res.code === 0) {
          console.log(res);
          //基本信息
          this.formData.basic.name = res.baseInfo.name;
          this.formData.basic.tel = res.baseInfo.phone;
          this.formData.basic.weixin = res.baseInfo.wechatId;
          this.formData.basic.sex = res.baseInfo.gender + '';
          this.formData.basic.shenId = res.baseInfo.identification;
          this.formData.basic.city = JSON.parse(res.baseInfo.city);
          this.formData.basic.birthData = res.baseInfo.dateOfBirth;
          this.formData.basic.familyAddress = res.baseInfo.familyAddress;
          this.formData.basic.liveAddress = res.baseInfo.currentAddress;
          this.formData.basic.marriage = res.baseInfo.maritalStatus + "";
          this.formData.basic.spouseName = res.baseInfo.spouseName;
          this.formData.basic.spouseTel = res.baseInfo.spousesPhone;
          this.formData.basic.workCompany = res.baseInfo.workUnits;
          this.formData.basic.touImg = res.baseInfo.headPhoto;
          //学历信息
          this.formData.EDU.isGraduation = res.educationInfo.isGraduation + '';
          this.formData.EDU.education = res.educationInfo.education;
          this.formData.EDU.schoolName = res.educationInfo.schoolName;
          this.formData.EDU.schoolAddress = res.educationInfo.schoolAddress;
          this.formData.EDU.cardNumber = res.educationInfo.graduationCertificate;
          this.formData.EDU.studentNumber = res.educationInfo.studentNumber;
          this.formData.EDU.check = res.educationInfo.inspect;
          //车辆信息
          this.formData.car.isCar = res.vehicleInfo.isVehicle + '';
          this.formData.car.greenBookImg = res.vehicleInfo.greenThisPhoto;
          this.formData.car.drivingLicenseImg = res.vehicleInfo.drivingPermitPhoto;
          this.formData.car.carBrand = res.vehicleInfo.vehicleBrand;
          this.formData.car.carType = res.vehicleInfo.vehicleType;
          this.formData.car.carCity = JSON.parse(res.vehicleInfo.cityVehicleOwnership);
          this.formData.car.carId = res.vehicleInfo.vehicleIdentificationNumber;
          this.formData.car.engineNumber = res.vehicleInfo.engineNumber;
          this.formData.car.carMoney = res.vehicleInfo.vehicleValuationAmount;
          this.formData.car.isMortgage = res.vehicleInfo.ifMortgage + '';
          this.formData.car.monthMoney = res.vehicleInfo.monthlyPaymentAmount;
          //房屋信息
          this.formData.room.isRoom = res.tenementInfo.isTenement + '';
          this.formData.room.isMortgage = res.tenementInfo.isMortgage + '';
          this.formData.room.roomContractImg = res.tenementInfo.photosHousingContract;
          this.formData.room.contractName = res.tenementInfo.obligee;
          this.formData.room.realEstateImg = res.tenementInfo.realEstatePhoto;
          this.formData.room.roomBookName = res.tenementInfo.roomsName;
          this.formData.room.roomNature = res.tenementInfo.houseProperty;
          this.formData.room.roomCity = JSON.parse(res.tenementInfo.city);
          this.formData.room.roomAddress = res.tenementInfo.isLocated;
          this.formData.room.realEstateNumber = res.tenementInfo.realEstateUnit;
          this.formData.room.roomType = res.tenementInfo.housingTypes;
          this.formData.room.purpose = res.tenementInfo.purpose;
          this.formData.room.square = res.tenementInfo.proportion;
          this.formData.room.roomMoney = res.tenementInfo.tenementValuationAmount;
          this.formData.room.roomAge = res.tenementInfo.tenementAge;
          this.formData.room.roomOther = res.tenementInfo.powerOtherConditions;
          //企业融资信息
          this.formData.enterprise.isEnterprise = res.corporateFinanceInfo.isCorporateFinance + '';
          this.formData.enterprise.businessImg = res.corporateFinanceInfo.businessLicensePhoto;
          this.formData.enterprise.companyName = res.corporateFinanceInfo.companyName;
          this.formData.enterprise.companyAddress = res.corporateFinanceInfo.companyAddress;
          this.formData.enterprise.companyTel = res.corporateFinanceInfo.companyTel;
          this.formData.enterprise.companyIdentity = res.corporateFinanceInfo.corporateIdentity + '';
          this.formData.enterprise.ShareholdingNumber = res.corporateFinanceInfo.percentageShareholding;
          //税贷信息
          this.formData.taxCredit.isTaxCredit = res.taxGenerationInfo.isTaxGeneration + '';
          this.formData.taxCredit.yearPayTaxesMoney = res.taxGenerationInfo.annualTaxPayment;
          this.formData.taxCredit.payTaxesGrade = res.taxGenerationInfo.brackets;
          //其他信息
          this.formData.Other.wagesNumber = res.elseInfo.clockingSalaryAmount;
          this.formData.Other.wagesType = res.elseInfo.issueForm;
          this.formData.Other.enterpriseNature = res.elseInfo.enterpriseProperty;
          this.formData.Other.companyTel = res.elseInfo.workTelephone;
          this.formData.Other.accumulationMoneypersonal = res.elseInfo.providentFundPayment;
          this.formData.Other.AM_paymentTime = res.elseInfo.gongPayOften;
          this.formData.Other.sociologyGuaranteeMoney = res.elseInfo.socialBase;
          this.formData.Other.SGM_paymentTime = res.elseInfo.shePayOften;
          this.formData.Other.ZFB_number = res.elseInfo.alipaySesamePoints;
          this.formData.Other.WLD_number = res.elseInfo.microparticleCreditLine;
          this.formData.Other.policyImg = res.elseInfo.guarantee;
          this.formData.Other.policyHighestMoney = res.elseInfo.singlePolicyHighest;
          this.formData.Other.P_paymentTime = res.elseInfo.policyDuration;
          //联系人信息
          this.formData.contacts.linealName = res.contactInfo.nameImmediateFamily;
          this.formData.contacts.l_relationship = res.contactInfo.relationOne;
          this.formData.contacts.l_tel = res.contactInfo.numberImmediateFamily;
          this.formData.contacts.l_company = res.contactInfo.immediateFamilyUnit;
          this.formData.contacts.one_linealName = res.contactInfo.otherContactsOne;
          this.formData.contacts.one_relationship = res.contactInfo.otherContactRelatioOne;
          this.formData.contacts.one_tel = res.contactInfo.otherContactsOne;
          this.formData.contacts.one_company = res.contactInfo.otherContactsOneUnit;
          this.formData.contacts.two_linealName = res.contactInfo.otherContactsTwo;
          this.formData.contacts.two_relationship = res.contactInfo.otherContactRelatioTwo;
          this.formData.contacts.two_tel = res.contactInfo.otherContactNumbersTwo;
          this.formData.contacts.two_company = res.contactInfo.otherContactsTwoUnit;
          this.formData.contacts.three_linealName = res.contactInfo.otherContactsThree;
          this.formData.contacts.three_relationship = res.contactInfo.otherContactRelatioThree;
          this.formData.contacts.three_tel = res.contactInfo.otherContactNumbersThree;
          this.formData.contacts.three_company = res.contactInfo.otherContactsThreeUnit;
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 基本信息保存
    addBasicSub() {
      this.formData.basic.loading = true;
      let query = {
        id: this.operationId,
        city: JSON.stringify(this.formData.basic.city),
        currentAddress: this.formData.basic.liveAddress,
        dateOfBirth: this.formData.basic.birthData,
        familyAddress: this.formData.basic.familyAddress,
        gender: this.formData.basic.sex,
        identification: this.formData.basic.shenId,
        maritalStatus: this.formData.basic.marriage,
        name: this.formData.basic.name,
        phone: this.formData.basic.tel,
        spouseName: this.formData.basic.spouseName,
        spousesPhone: this.formData.basic.spouseTel,
        wechatId: this.formData.basic.weixin,
        workUnits: this.formData.basic.workCompany,
        headPhoto: this.formData.basic.touImg,
      };
      if (this.operationId) {
        userEditBasicSub(query).then((res) => {
          this.formData.basic.loading = false;
          if (res.code === 0) {
            this.$message.success('基本信息 编辑保存成功');
          } else {
            this.$message(res.msg);
          }
        });
      } else {
        userAddBasicSub(query).then((res) => {
          this.formData.basic.loading = false;
          if (res.code === 0) {
            this.$message.success('基本信息 保存成功');
          } else {
            this.$message(res.msg);
          }
        });
      }
    },

    //新增 学历信息保存
    addEDUSub() {
      this.formData.EDU.loading = true;
      let query = {
        biId: this.operationId,
        isGraduation: this.formData.EDU.isGraduation,
        education: this.formData.EDU.education,
        schoolName: this.formData.EDU.schoolName,
        schoolAddress: this.formData.EDU.schoolAddress,
        graduationCertificate: this.formData.EDU.cardNumber,
        studentNumber: this.formData.EDU.studentNumber,
        inspect: this.formData.EDU.check,
      };
      userEditEDUSub(query).then((res) => {
        this.formData.EDU.loading = false;
        if (res.code === 0) {
          this.$message.success('学历信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 车辆信息
    addCarSub() {
      this.formData.car.loading = true;
      let query = {
        biId: this.operationId,
        isVehicle: this.formData.car.isCar,
        greenThisPhoto: this.formData.car.greenBookImg,
        drivingPermitPhoto: this.formData.car.drivingLicenseImg,
        vehicleBrand: this.formData.car.carBrand,
        vehicleType: this.formData.car.carType,
        cityVehicleOwnership: JSON.stringify(this.formData.car.carCity),
        vehicleIdentificationNumber: this.formData.car.carId,
        engineNumber: this.formData.car.engineNumber,
        vehicleValuationAmount: this.formData.car.carMoney,
        ifMortgage: this.formData.car.isMortgage,
        monthlyPaymentAmount: this.formData.car.monthMoney,
      };
      userEditCarSub(query).then((res) => {
        this.formData.car.loading = false;
        if (res.code === 0) {
          this.$message.success('车辆信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 房屋信息
    addRoomSub() {
      this.formData.room.loading = true;
      let query = {
        biId: this.operationId,
        isTenement: this.formData.room.isRoom,
        isMortgage: this.formData.room.isMortgage,
        photosHousingContract: this.formData.room.roomContractImg,
        obligee: this.formData.room.contractName,
        realEstatePhoto: this.formData.room.realEstateImg,
        roomsName: this.formData.room.roomBookName,
        houseProperty: this.formData.room.roomNature,
        city: JSON.stringify(this.formData.room.roomCity),
        isLocated: this.formData.room.roomAddress,
        realEstateUnit: this.formData.room.realEstateNumber,
        housingTypes: this.formData.room.roomType,
        purpose: this.formData.room.purpose,
        proportion: this.formData.room.square,
        tenementValuationAmount: this.formData.room.roomMoney,
        tenementAge: this.formData.room.roomAge,
        powerOtherConditions: this.formData.room.roomOther,
      };
      userEditRoomSub(query).then((res) => {
        this.formData.room.loading = false;
        if (res.code === 0) {
          this.$message.success('房屋信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 企业融资信息
    addEnterpriseSub() {
      this.formData.enterprise.loading = true;
      let query = {
        biId: this.operationId,
        isCorporateFinance: this.formData.enterprise.isEnterprise,
        businessLicensePhoto: this.formData.enterprise.businessImg,
        companyName: this.formData.enterprise.companyName,
        companyAddress: this.formData.enterprise.companyAddress,
        companyTel: this.formData.enterprise.companyTel,
        corporateIdentity: this.formData.enterprise.companyIdentity,
        percentageShareholding: this.formData.enterprise.ShareholdingNumber,
      };
      userEditEnterpriseSub(query).then((res) => {
        this.formData.enterprise.loading = false;
        if (res.code === 0) {
          this.$message.success('企业融资信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 税贷信息
    addTaxCreditSub() {
      this.formData.taxCredit.loading = true;
      let query = {
        biId: this.operationId,
        isTaxGeneration: this.formData.taxCredit.isTaxCredit,
        annualTaxPayment: this.formData.taxCredit.yearPayTaxesMoney,
        brackets: this.formData.taxCredit.payTaxesGrade,
      };
      userEditTaxCreditSub(query).then((res) => {
        this.formData.taxCredit.loading = false;
        if (res.code === 0) {
          this.$message.success('企业融资信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 其他信息
    addOtherSub() {
      this.formData.Other.loading = true;
      let query = {
        biId: this.operationId,
        clockingSalaryAmount: this.formData.Other.wagesNumber,
        issueForm: this.formData.Other.wagesType,
        enterpriseProperty: this.formData.Other.enterpriseNature,
        workTelephone: this.formData.Other.companyTel,
        providentFundPayment: this.formData.Other.accumulationMoneypersonal,
        gongPayOften: this.formData.Other.AM_paymentTime,
        socialBase: this.formData.Other.sociologyGuaranteeMoney,
        shePayOften: this.formData.Other.SGM_paymentTime,
        alipaySesamePoints: this.formData.Other.ZFB_number,
        microparticleCreditLine: this.formData.Other.WLD_number,
        guarantee: this.formData.Other.policyImg,
        singlePolicyHighest: this.formData.Other.policyHighestMoney,
        policyDuration: this.formData.Other.P_paymentTime,
      };
      userEditOtherSub(query).then((res) => {
        this.formData.Other.loading = false;
        if (res.code === 0) {
          this.$message.success('其他信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //新增 联系人信息
    addContactsSub() {
      this.formData.contacts.loading = true;
      let query = {
        biId: this.operationId,
        nameImmediateFamily: this.formData.contacts.linealName,
        relationOne: this.formData.contacts.l_relationship,
        numberImmediateFamily: this.formData.contacts.l_tel,
        immediateFamilyUnit: this.formData.contacts.l_company,
        otherContactsOne: this.formData.contacts.one_linealName,
        otherContactRelatioOne: this.formData.contacts.one_relationship,
        otherContactNumbersOne: this.formData.contacts.one_tel,
        otherContactsOneUnit: this.formData.contacts.one_company,
        otherContactsTwo: this.formData.contacts.two_linealName,
        otherContactRelatioTwo: this.formData.contacts.two_relationship,
        otherContactNumbersTwo: this.formData.contacts.two_tel,
        otherContactsTwoUnit: this.formData.contacts.two_company,
        otherContactsThree: this.formData.contacts.three_linealName,
        otherContactRelatioThree: this.formData.contacts.three_relationship,
        otherContactNumbersThree: this.formData.contacts.three_tel,
        otherContactsThreeUnit: this.formData.contacts.three_company,
      };
      userEditContactsSub(query).then((res) => {
        this.formData.contacts.loading = false;
        if (res.code === 0) {
          this.$message.success('联系人信息 保存成功');
        } else {
          this.$message(res.msg);
        }
      });
    },
    //加入黑名单
    blacklist(id) {
      this.loading = true;
      userBlackList({ biId: id }).then((res) => {
        this.loading = false;
        if (res.code === 0) {
          this.$message.success('添加成功');
          this.getListData();
        } else {
          this.$message(res.msg);
        }
      });
    },
    //上传头像
    filetouChange(response, file, fileList) {
      this.formData.basic.touLoad = false;
      this.$refs.uploadtou.clearFiles();
      if (response.code === 0) {
        this.cropper.option.img = response.base64EncoderImg;
        this.cropper.cropperFlg = true;
      } else {
        this.$message('上传失败');
      }
    },
    //上传中
    filetouloadChange() {
      this.formData.basic.touLoad = true;
    },
    //裁剪
    finish() {
      this.updateImgLoad = true;
      this.$refs.cropper.getCropData((data) => {
        businessListAddBase64({ base64: data }).then((res) => {
          this.updateImgLoad = false;
          if (res.code == 0) {
            this.$message.success('上传成功');
            this.formData.basic.touImg = res.path;
            this.cropper.cropperFlg = false;
          } else {
            this.$message(res.msg);
          }
        })
      });
    },
    //上传中
    fileloadChange(item) {
      // switch (item) {
      //   case 'greenBookImgLoad': this.formData.car[item] = true; break;
      //   case 'drivingLicenseImgLoad': this.formData.car[item] = true; break;
      //   case 'roomContractImgLoad': this.formData.room[item] = true; break;
      //   case 'realEstateImgLoad': this.formData.room[item] = true; break;
      //   case 'businessImgLoad': this.formData.enterprise[item] = true; break;
      //   case 'policyImgLoad': this.formData.Other[item] = true; break;
      // }
    },
    //上传成功
    fileChange(item, res, file) {
      console.log(item)
      console.log(res)
      console.log(file)
      let load = item + 'Load';
      switch (load) {
        case 'greenBookImgLoad': this.formData.car[load] = false; break;
        case 'drivingLicenseImgLoad': this.formData.car[load] = false; break;
        case 'roomContractImgLoad': this.formData.room[load] = false; break;
        case 'realEstateImgLoad': this.formData.room[load] = false; break;
        case 'businessImgLoad': this.formData.enterprise[load] = false; break;
        case 'policyImgLoad': this.formData.Other[load] = false; break;
      }
      if (res.code === 0) {
        switch (item) {
          case 'greenBookImg': this.formData.car[item] = res; break;
          case 'drivingLicenseImg': this.formData.car[item] = res; break;
          case 'roomContractImg': this.formData.room[item] = res; break;
          case 'realEstateImg': this.formData.room[item] = res; break;
          case 'businessImg': this.formData.enterprise[item] = res; break;
          case 'policyImg': this.formData.Other[item] = res; break;
        }
        // this.$message.success('上传成功');
      }
      // this.excelLoad = false;
      // this.$refs.upload.clearFiles();
      // if (response.code === 0) {
      //   this.$message.success('上传成功');
      //   this.getData();
      // } else {
      //   this.$message('上传失败');
      // }
    }
  }
};
</script>

<style scoped>
/deep/ :focus {
    outline: 0;
}
.handle-input {
    width: 300px;
    display: inline-block;
}
.nameDrawer {
    padding: 30px;
}
.elSelect {
    width: 100%;
}
.upload-demo {
    height: 32px;
}
.heng-border {
    height: 0.5px;
    margin-bottom: 30px;
}

/* 截图 */
.cropper-content .cropper {
    width: auto;
    height: 300px;
}
.refund-list {
    margin-bottom: 10px;
}
.payment_type {
    padding: 10px 0;
}
</style>
